package net.lab1024.sa.admin.module.business.yct.yctTeeth.controller;

import com.alibaba.fastjson.JSONObject;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.form.YctTeethHospitalAddForm;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.form.YctTeethHospitalQueryForm;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.form.YctTeethHospitalUpdateForm;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.vo.YctTeethHospitalVO;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.service.YctTeethHospitalService;
import net.lab1024.sa.admin.module.business.yct.yctproductinstructions.domain.form.YctProductInstructionsQueryForm;
import net.lab1024.sa.admin.module.business.yct.yctproductinstructions.domain.vo.YctProductInstructionsVO;
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * 易齿通口腔门诊 Controller
 *
 * @Author zhangben
 * @Date 2024-11-07 09:39:15
 * @Copyright 20241107
 */

@RestController
@Tag(name = "易齿通口腔门诊")
public class YctTeethHospitalController {

    @Resource
    private YctTeethHospitalService yctTeethHospitalService;

    @Operation(summary = "分页查询 @author zhangben")
    @PostMapping("/yctTeethHospital/queryPage")
    @SaCheckPermission("yctTeethHospital:query")
    public ResponseDTO<PageResult<YctTeethHospitalVO>> queryPage(@RequestBody @Valid YctTeethHospitalQueryForm queryForm) {
        return ResponseDTO.ok(yctTeethHospitalService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author zhangben")
    @PostMapping("/yctTeethHospital/add")
    @SaCheckPermission("yctTeethHospital:add")
    public ResponseDTO<String> add(@RequestBody @Valid YctTeethHospitalAddForm addForm) {
        return yctTeethHospitalService.add(addForm);
    }

    @Operation(summary = "更新 @author zhangben")
    @PostMapping("/yctTeethHospital/update")
    @SaCheckPermission("yctTeethHospital:update")
    public ResponseDTO<String> update(@RequestBody @Valid YctTeethHospitalUpdateForm updateForm) {
        return yctTeethHospitalService.update(updateForm);
    }


    @Operation(summary = "单个删除 @author zhangben")
    @GetMapping("/yctTeethHospital/delete/{hospiatlId}")
    @SaCheckPermission("yctTeethHospital:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long hospiatlId) {
        return yctTeethHospitalService.delete(hospiatlId);
    }
    @NoNeedLogin
    @PostMapping("/yctTeethHospital/queryPageList")
    public ResponseDTO<PageResult<YctTeethHospitalVO>> queryPageList(@RequestBody @Valid YctProductInstructionsQueryForm queryForm) {
        return ResponseDTO.ok(yctTeethHospitalService.queryPageList(queryForm));
    }

    @NoNeedLogin
    @GetMapping("/yctTeethHospital/select/{hospiatlId}")
    public ResponseDTO<YctTeethHospitalVO> select(@PathVariable Long hospiatlId) {
        return ResponseDTO.ok(yctTeethHospitalService.select(hospiatlId));
    }

    @PostMapping("/yctTeethHospital/getQr")
    public ResponseDTO<Map<String, Object>> getQr(@RequestBody JSONObject data) {
        return ResponseDTO.ok(yctTeethHospitalService.getQr(data));
    }
}
